package com.hmall.common.config;

import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "hm.mq")
@ConditionalOnProperty(prefix = "hm.mq", name = "enabled", havingValue = "true", matchIfMissing = false)
public class MqConfig {
    private String host = "192.168.100.168";
    private Integer port = 5672;
    private String vhost = "/hmall";
    private String username = "itheima";
    private String password = "123321";
    
    private Listener listener = new Listener();
    
    @Data
    public static class Listener {
        private Retry retry = new Retry();
        
        @Data
        public static class Retry {
            private Boolean enable = true;
            private Integer interval = 1000;
            private Integer multiplier = 1;
            private Integer maxAttempts = 3;
            private Boolean stateless = true;
        }
    }
}